home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BCI NET
/
BCI NET Dec 94.iso
/
archives
/
programming
/
c
/
gcc261ud-c.lha
/
gnu
/
os-include
/
inline
/
strsup.h
< prev
next >
Wrap
C/C++ Source or Header
|
1994-10-24
|
1KB
|
85 lines
#if !defined(_STRSUP_H) && defined(__OPTIMIZE__)
#define _STRSUP_H
#include <sys/types.h>
extern inline size_t strlen_plus_one(const char *string)
{
const char *s=string;
while(*s++)
;
return (s-string);
}
extern inline size_t strlen(const char *string)
{
const char *s=string;
while(*s++)
;
return ~(string-s);
}
extern inline char *strcpy(char *s1,const char *s2)
{ char *s=s1;
do
*s++=*s2;
while(*s2++!='\0');
return s1;
}
extern inline char *strcat(char *s1,const char *s2)
{
char *s=s1;
while(*s++)
;
--s;
while((*s++=*s2++))
;
return s1;
}
extern inline char *strchr(const char *s,int c)
{
while (*s!=(char)c)
if (!(*s++))
{
s=NULL;
break;
}
return (char *)s;
}
extern inline char *strupr(char *s)
{
unsigned char *s1;
s1=(unsigned char *)s;
while(*s1)
{
if ((*s1>('a'-1)) && (*s1<('z'+1)))
*s1-='a'-'A';
s1++;
}
return s;
}
extern inline char *strlwr(char *s)
{
unsigned char *s1;
s1=(unsigned char *)s;
while(*s1)
{
if ((*s1>('A'-1)) && (*s1<('Z'+1)))
*s1+='a'-'A';
s1++;
}
return s;
}
#endif /* _STRSUP_H */